  <form action="<?php echo $PHP_SELF; ?>" method="POST">

	<h3>Contacts</h3>
	<div id="searchshow">
		<a href="#" onclick="javascript:toggleVisibility('search');">Show Search</a>
	</div>
	<div id="search" style="display:none;">
	    <a href="#" onclick="javascript:toggleVisibility('search');">Hide Search</a>
	<table id="data">
		<tr><th>First Name:</th><td width="80%"><input type="text" name="firstname" value="<?php echo $c->contact->firstname; ?>" /></td></tr>
    	<tr><th>Last Name:</td><td><input type="text" name="lastname" value="<?php echo $c->contact->lastname; ?>" /></td></tr>
    	<tr><th>E-mail:</th><td><input type="text" name="email" value="<?php echo $c->contact->email; ?>" /></td></tr>
    	<tr><th>Work:</th><td><input type="text" name="work_phone" value="<?php echo $c->contact->work_phone; ?>" /></td></tr>
    	<tr><th>Home:</th><td><input type="text" name="home_phone" value="<?php echo $c->contact->home_phone; ?>" /></td></tr>
    	<tr><th>Cell:</th><td><input type="text" name="cell_phone" value="<?php echo $c->contact->cell_phone; ?>" /></td></tr>
    	<tr><th>Fax:</th><td><input type="text" name="fax" value="<?php echo $c->contact->fax; ?>" /></td></tr>

    	<tr><th>Address:</th><td><div id="addressDiv">
    		<?php echo tableDropdown("address_id", $c->contact->address_id, $c->addresses, "line1, city, state, zip"); ?>
    		<small><?php echo HtmlUtil::internalAsynchLink("[expand address]", "address", $userRoles); ?></small></div>
    	</td></tr>
    	<tr><td>&nbsp;</td><td><input type="submit" name="action" value="Search" /></td>
    </table>
	</div>
	<br/>
	<?php if (count($c->contacts) > 0) { ?>
    <table id="results">
     <tr><th>Name</th><th>E-mail</th><th>Work Phone</th><th>Home Phone</th><th>Cell Phone</th></tr>
    <?php
     foreach ($c->contacts as $contact)
     {
       $name = $contact->firstname . " " . $contact->lastname;
       ?>
       <tr>
       	<td><?php echo HtmlUtil::internalLink("[edit]", "contact", $userRoles, array("action" => "load", "id" => $contact->id)); ?>
       		<?php echo HtmlUtil::internalLink($name, "viewContact", $userRoles, array("action" => "load", "id" => $contact->id), $name); ?></td>
       	<td><?php echo "<a href=\"mailto:" . $contact->email . "\">" . $contact->email . "</a>"; ?></td>
       	<td><?php echo $contact->work_phone; ?></td>
       	<td><?php echo $contact->home_phone; ?></td>
       	<td><?php echo $contact->cell_phone; ?></td>
       </tR>
       <?php
     }
    ?>
    </table>
    <?php } ?>
  </form>